﻿using System;

namespace AspectIntercept
{
    [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = true)]
    public class PreProcessAttribute : Attribute
    {
        public IPreProcessor Processor { get; private set; }

        public PreProcessAttribute(Type preProcessorType)
        {
            this.Processor = Activator.CreateInstance(preProcessorType) as IPreProcessor;
            if (this.Processor == null)
                throw new ArgumentException(String.Format("The type '{0}' does not implement interface IPreProcessor", preProcessorType.Name, "processorType"));
        }
    }
}
